﻿using B.S.Filtration.Read.Api.Application.Command.PowerCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using B.S.Filtration.Domain;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using B.S.Filtration.ErrorCode;

namespace B.S.Filtration.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PowerController : ControllerBase
    {
        private readonly IMediator mediator;

        public PowerController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 查询动力准备信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<Power>>> QueryPower([FromQuery]QueryPowerCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 反填动力准备信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Power>>> ShowPower([FromQuery]ShowPowerCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
